<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
	</head>

	<body>
		<button id="btn">获取数据</button>
		<ul id="ul1"></ul>
		<script src="ajax.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var oBtn = document.getElementById("btn");
			var oUl = document.getElementById("ul1");
			oBtn.onclick = function  () {
				var opt = {
					method : "get",
					url : '/getNews',
					data : "",
					success : function  (data) {
						//  创建li 把数据放到li里面去
						for(var i=0;i < data.length; i++){
							var oLi = document.createElement('li');
							oLi.innerHTML = data[i].title;
							oUl.appendChild(oLi);
						}
					}
				};
				ajax(opt);

            }
		</script>
	</body>

</html>
